package org.clockworkmages.games.anno1186.situations.combat.options;

import org.clockworkmages.games.anno1186.GameBeansContext;
import org.clockworkmages.games.anno1186.GameStateService;
import org.clockworkmages.games.anno1186.TimeConstants;
import org.clockworkmages.games.anno1186.model.option.Option;
import org.clockworkmages.games.anno1186.situations.combat.CombatSituation;
import org.clockworkmages.games.anno1186.situations.combat.CombatStatus;

public class SurrenderOption
		extends Option {

	private final GameStateService gameStateService;

	public SurrenderOption() {
		this.setConsumesCombatAction(true);
		this.setTimePassed(TimeConstants.COMBAT_TURN);

		gameStateService = GameBeansContext.getBean(GameStateService.class);

		this.setLabel("Surrender");
		this.setTooltip("Surrender and put yourself at your opponent's mercy");
		this.setTextAfter("You have surrendered!");

	}

	@Override
	public void select() {
		CombatSituation combatSituation = gameStateService
				.getCurrentCombatSituation();
		combatSituation.setCombatStatus(CombatStatus.SURRENDERED);
		super.select();
	}

}
